<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head>
  <title>[untitled]</title>
  <link rel="stylesheet" type="text/css" href="../../t/vim_syntax.css" />
 </head>
 <body>

<pre><span class="synComment"># vim:ft=perl</span>

<span class="synStatement">use strict</span>;
<span class="synStatement">use warnings</span>;

<span class="synIdentifier">$log</span> =~ <span class="synStatement">s{</span>
<span class="synString">    </span><span class="synSpecial">(</span><span class="synString">%d</span><span class="synSpecial">(?:</span><span class="synString">{(.*?)}</span><span class="synSpecial">)?)</span><span class="synString">|   # </span><span class="synIdentifier">$1</span><span class="synString">: datetime </span><span class="synIdentifier">$2</span><span class="synString">: datetime fmt</span>
<span class="synString">    </span><span class="synSpecial">(?:</span><span class="synString">%</span><span class="synSpecial">(</span><span class="synString">[%pmFLPn</span><span class="synSpecial">\$</span><span class="synString">]</span><span class="synSpecial">))</span><span class="synString">    # </span><span class="synIdentifier">$3</span><span class="synString">: others</span>
<span class="synStatement">}{</span>
<span class="synString">    if (</span><span class="synIdentifier">$1</span><span class="synString"> &amp;&amp; </span><span class="synIdentifier">$2</span><span class="synString">) {</span>
<span class="synString">        my </span><span class="synIdentifier">$dt_fmt</span><span class="synString"> = </span><span class="synIdentifier">$2</span><span class="synString">;</span>
<span class="synString">        my </span><span class="synIdentifier">$now</span><span class="synString"> = (</span><span class="synIdentifier">$dt_fmt</span><span class="synString"> =~ /</span><span class="synSpecial">\%</span><span class="synString">[369]?N/)</span>
<span class="synString">            ? (Time::HiRes::time)</span>
<span class="synString">            : time;</span>
<span class="synString">        DateTime-&gt;from_epoch(epoch=&gt;</span><span class="synIdentifier">$now</span><span class="synString">)-&gt;strftime(</span><span class="synIdentifier">$dt_fmt</span><span class="synString">);</span>
<span class="synString">    }</span>
<span class="synString">    elsif (</span><span class="synIdentifier">$1</span><span class="synString">) {</span>
<span class="synString">        scalar localtime;</span>
<span class="synString">    }</span>
<span class="synString">    elsif (</span><span class="synIdentifier">$3</span><span class="synString">) {</span>
<span class="synString">        </span><span class="synIdentifier">$p{$3}</span><span class="synString">;</span>
<span class="synString">    }</span>
<span class="synStatement">}egx</span>;
</pre>

 </body>
</html>
